$(document).ready(function() {
	$(window).resize(function() {
		chart.resize();
	});

});


/************************************************************************************************************************/
//圆环图表--主要用于投资测算图表
function chart_two_pie(yarr_return_compare_rate, yarr_return_rate, circle_Obj) {
	//yarr_return_rate=-50;	
	var yarr_return_show=0;
	if(yarr_return_rate>=0&&yarr_return_rate<=100){
		yarr_return_show=yarr_return_rate;
	}else{
		if(yarr_return_rate<0){
			yarr_return_show=0;
		}else{
			yarr_return_show=100;
		}
		
	}
	
	var zhan=100-yarr_return_show;
	
	
	
	var myChart = echarts.init(document.getElementById(circle_Obj));
	option = {
		title: {
			text: '投资回报率', //投资回报率
			x: 'center',
			y: 'top',
			textStyle: {fontSize: 20, color: '#4D4D4D',fontWeight:'normal'}
		},
		tooltip: {
			trigger: 'item',
			formatter: "{a} <br/>{b} : {c} ({d}%)"
		},
		
		series: [
			{
				name: '外环的黄色饼图',
				type: 'pie',
				radius: ['50%', '65%'],
				center: ['50%', '50%'],//'50%', '55%'
				label: {
					normal: {
						position: 'center', padding: [30, 0, 0]
					}
				},
				itemStyle: {
					normal: {
						label: {
							show: true,
							formatter: '{b}%'
						},
						labelLine: {
							show: false
						},

						color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
							offset: 0,
							color: 'rgba(255,162,0,1)' //'#ffa200'
						}, {
							offset: 1,
							color: 'rgba(255,106,76,1)' //'#ff6a4c'
						}]),
						borderColor: "#FF6a4c",
						borderWidth: 0
					}
				},
				data: [
				    {
						value: yarr_return_show,
						name: '投资回报率',
						label: {
							x: 'center',
							y: 'top',
							normal: {
								formatter: yarr_return_rate+'%',//'{c} %',
								textStyle: {
									padding: [45, 0, 0],
									color: '#4D4D4D',
									fontSize: 40,//中间数值的大小--------------------
									fontWeight: 700,
								}
							}
						}
					}, 
					{
						value: zhan,
						name: '占位',
						label: {
							normal: {
								formatter: '\n投资回报率',
								textStyle: {
									color: '#808080',
									fontSize: 15
								}
							}
						},
						tooltip: {
							show: false
						},
						itemStyle: {
							normal: {
								label: {
									show: true,
									formatter: '{b}%'
								},
								labelLine: {
									show: false
								},

								color: "transparent",
								borderColor: "#4198ff",
								borderWidth: 0
							}
						},
						hoverAnimation: false
					}
				]
			},
			{

				name: '内环的蓝色小圆图',
				type: 'pie',
				radius: ['52%', '63%'],
				center: ['50%', '50%'],//'50%', '55%'
				label: {
					normal: {
						show: false
					}
				},
				tooltip: {
					show: false
				},
				itemStyle: {
					normal: {
						label: {
							show: true,
							formatter: '{b}%'
						},
						labelLine: {
							show: false
						},
							color: "#4198ff",
						borderColor: "#4198ff",
						borderWidth: 0
					}
				},
				hoverAnimation: false,
				data: [
				    {
						value: yarr_return_show,
						name: '投资回报率',
						itemStyle: {
							normal: {
								color: "transparent",
							}
						},
					}, 
					{
						value: zhan,
						name: '占位',
						itemStyle: {
							normal: {
								color: new echarts.graphic.LinearGradient(1, 1, 0, 1, [{
									offset: 0,
									color: 'rgba(13,207,255,1)' //'#0dcfff'
								}, {
									offset: 1,
									color: 'rgba(65,152,255,1)' //'#4198ff'
								}]),
							}
						},
					}
				]
			
			}
		    
		]
	};
	myChart.setOption(option);

}
